package com.han.agent.tools;

import org.springframework.ai.tool.annotation.Tool;

import java.io.FileInputStream;
import java.time.LocalDateTime;

/**
 * @author han
 */
public class DateTool {

    @Tool(description = "获取当前时间")
    String currentLocalDateTime() {
        return LocalDateTime.now().toString();
    }

    @Tool(description = "读取test文档.txt的内容")
    String readText() {
        String resultStr;
        try {
            FileInputStream fileInputStream = new FileInputStream("E:\\test文档.txt");
            byte[] bytes = fileInputStream.readAllBytes();
            resultStr = new String(bytes);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return resultStr;
    }

}
